package cn.dbqn.controller;

import cn.dbqn.entity.Drug;
import cn.dbqn.service.DrugService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class DrugController {
    @Resource
    DrugService drugService;

    @RequestMapping("/listypxx")
    public String list(Model model){
        List<Drug> list=drugService.findAllYpxx();
        model.addAttribute("list",list);
        return "lyear_js_notify";
    }

    @ResponseBody
    @RequestMapping("ypxx")
    public Object ypxx(@RequestParam("dno")Integer dno){
        Drug ypxx=drugService.ypxx(dno);
        return ypxx;
    }
}
